<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/Site.Master" Inherits="System.Web.Mvc.ViewPage<DomainModel.Entities.Event>" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">
    Details
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <h2>
        Event Details</h2>
    <div class="zone_events float_left">
    <div class="event_details">
    
    
        <div>
            <%
                // add or remove rates from list
                if (RateService.IsUserRated(HttpContext.Current, Model.EventID))
                {    %>
            <%= Html.ActionLink("Remove Rate", "RemoveEventRate", "rate", new { eventID = Model.EventID, returnurl = Request.RawUrl }, new { title = "add me to this event", @class = "site_link_04" })%>
            <%}
                else
                {%>
            <%= Html.ActionLink("Rate this", "AddEventRate", "rate", new { eventID = Model.EventID, returnurl = Request.RawUrl }, new { title = "remove me from this event", @class = "site_link_04" })%>
            <%}%>
        </div>
       <ul> <li>
            <label>
                Title:</label>
            <%= Model.Title %></li>
        <li>
            <label>
                Date:</label>
            <%= Model.DateEvent.ToString("yyyy-MM-dd HH:mm")%></li>
        <li>
            <label>
                Description:</label>
            <%= Model.Description %></li>
        <li>
            <label>
                Address:</label>
            <%= Model.Address %></li>
        <li>
            <label>
                Contact:</label>
            <%= Model.ContactPhone%></li>
        <li>
            <label>
                Tags:
            </label>
            <%Html.RenderPartial("../Tag/TagLine", Model); %>
        </li>
        </ul>
       
       <br class="clear" />
       <br class="clear" />
        
        <%Html.RenderPartial("UserInfo32", Model.User); %>
        <div>
            <%
                // check whether the event was created by this user
                var isAdmin = UserHelper.IsAdminUser();
                if (UserHelper.IsCreatedByUserID(Model.UserID) || isAdmin)
                {%>
            <%if (isAdmin)
              { %>
            <%= Html.ActionLink("Edit", "EventEdit", "Event", new { id = Model.EventID, isAdmin = true }, new { title = Model.Title })%>
            |
            <%= Html.ActionLink("Delete", "EventDelete", "Event", new { id = Model.EventID }, new { title = "Delete - " + Model.Title})%>
            as admin
            <%}
              else
              { %>
            <%= Html.ActionLink("Edit", "EventEdit", "Event", new { id = Model.EventID }, new { title = "Edit - " + Model.Title})%>
            |
            <%= Html.ActionLink("Delete", "EventDelete", "Event", new { id = Model.EventID }, new { title = "Delete - " + Model.Title})%>
            <%}
                }%>
        </div>
        <div class="hr_bar clear">
            &nbsp;
        </div>
        <div>
            <%
                // add or remove user from list
                if (UserHelper.IsUserRegisteredWithEvent(HttpContext.Current, Model.EventID))
                {    %>
            <%= Html.ActionLink("remove me", "removeuser", "event", new { eventID = Model.EventID, returnurl = Request.RawUrl }, new { title = "remove me from this event", @class = "site_link_04" })%>
            <%}
                else
                {%>
            <%= Html.ActionLink("Add me", "adduser", "event", new { eventID = Model.EventID, returnurl = Request.RawUrl }, new { title = "add me to this event", @class = "site_link_04" })%>
            <%}%>
            <div class="float_right">
                <% Html.RenderPartial("Bookmark", Model.Title); %>
               <br class="clear" />
                 <%= Html.ActionLink("Add event to Outlook", "icsfile", new{ id = Model.EventID}) %>
            </div>
        </div>
        <!-- coming users  -->
        <% Html.RenderPartial("RSVPList", Model); %>
        <% Html.RenderPartial("CommentsList", Model.CommentsList.OfType<Comment>()); %>
        <% Html.RenderPartial("CommentForm", Model); %>
    </div> </div>
    <div class="zone_map float_right">
        <% Html.RenderPartial("SinglePointMap", Model); %>
    </div>
    
   
    <br class="clear" />
</asp:Content>
